using System;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;

using WHC.Pager.Entity;
using Microsoft.Practices.EnterpriseLibrary.Data;
using WHC.Hotel.Entity;
using WHC.Hotel.IDAL;
using WHC.OrderWater.Commons;

namespace WHC.Hotel.DAL
{
	/// <summary>
	/// KTVOtherIncome 的摘要说明。
	/// </summary>
	public class KTVOtherIncome : BaseDAL<KTVOtherIncomeInfo>, IKTVOtherIncome
	{
		#region 对象实例及构造函数

		public static KTVOtherIncome Instance
		{
			get
			{
				return new KTVOtherIncome();
			}
		}
		public KTVOtherIncome() : base("YL_KTVOtherIncome","ID")
		{
		}

		#endregion

		/// <summary>
		/// 将DataReader的属性值转化为实体类的属性值，返回实体类
		/// </summary>
		/// <param name="dr">有效的DataReader对象</param>
		/// <returns>实体类对象</returns>
		protected override KTVOtherIncomeInfo DataReaderToEntity(IDataReader dataReader)
		{
			KTVOtherIncomeInfo kTVOtherIncomeInfo = new KTVOtherIncomeInfo();
			SmartDataReader reader = new SmartDataReader(dataReader);
			
			kTVOtherIncomeInfo.ID = reader.GetInt32("ID");
            kTVOtherIncomeInfo.OperateType = reader.GetString("OperateType");
			kTVOtherIncomeInfo.Project = reader.GetString("Project");
			kTVOtherIncomeInfo.Unit = reader.GetString("Unit");
			kTVOtherIncomeInfo.Quantity = reader.GetInt32("Quantity");
			kTVOtherIncomeInfo.Price = reader.GetDecimal("Price");
			kTVOtherIncomeInfo.Amount = reader.GetDecimal("Amount");
			kTVOtherIncomeInfo.Operator = reader.GetString("Operator");
			kTVOtherIncomeInfo.OperateDate = reader.GetDateTime("OperateDate");
			kTVOtherIncomeInfo.Note = reader.GetString("Note");
			kTVOtherIncomeInfo.LastUpdated = reader.GetDateTime("LastUpdated");
			
			return kTVOtherIncomeInfo;
		}

		/// <summary>
		/// 将实体对象的属性值转化为Hashtable对应的键值
		/// </summary>
		/// <param name="obj">有效的实体对象</param>
		/// <returns>包含键值映射的Hashtable</returns>
        protected override Hashtable GetHashByEntity(KTVOtherIncomeInfo obj)
		{
		    KTVOtherIncomeInfo info = obj as KTVOtherIncomeInfo;
			Hashtable hash = new Hashtable(); 
			
            hash.Add("OperateType", info.OperateType);
 			hash.Add("Project", info.Project);
 			hash.Add("Unit", info.Unit);
 			hash.Add("Quantity", info.Quantity);
 			hash.Add("Price", info.Price);
 			hash.Add("Amount", info.Amount);
 			hash.Add("Operator", info.Operator);
 			hash.Add("OperateDate", info.OperateDate);
 			hash.Add("Note", info.Note);
 			hash.Add("LastUpdated", info.LastUpdated);
 				
			return hash;
		}

    }
}